#ifndef __THREADSERVER_H__
#define __THREADSERVER_H__

#include "../../test_type.h"
#include "../../../src/socket/TcpIoServer.h"
#include "../../../src/socket/TcpIoSocket.h"
#include "../../../src/stream/SocketIoBuffer.h"
#include "../../../src/log/LogFactory.h"
#include <iostream>
#include <memory>
#include <set>
#include <mutex>

namespace echo_service
{
	using namespace std;
	using namespace LibTools;

	class Session;

#define THREAD_NUM 2

	class ThreadService
	{
	public:
		ThreadService();
		~ThreadService();

		void Start(const char* addr = "0.0.0.0", DWORD port = 10003);

		static void StartAccept(CTcpIoServer *server);

		static DWORD HandleAccept(CSockError ec, void* invoker);

		static CTcpIoServer* GetNextServer();
	public:
		static vector<shared_ptr<CTcpIoServer>> _tcps;
		static CTcpIoSocket _svrSock;
	};
}

#endif